<template>
  <div>
    <h1>mycom1</h1>
    <button @click="sendToy">sendToy</button>
    <hr />
    <h2>store中的Value</h2>
    姓名：{{ $store.state.info.name }}<br />
    年龄：{{ $store.state.info.age }}<br />
    性别：{{ $store.state.info.sex }}<br />
    <br />
    <button @click="fnEmit">触发pubsub-js的方法</button>
  </div>
</template>

<script>
import pubsub from 'pubsub-js'
export default {
  name: 'mycom2',
  data() {
    return {}
  },

  methods: {
    sendToy() {
      this.$bus.$emit('getToy', 666)
    },
    fnEmit() {
      pubsub.publish('getValue', 'hello world')
    }
  }
}
</script>
